<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>手机号码归属地</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<!--引入公用样式-->
		<link rel="stylesheet" type="text/css" href="../css/public.css" />
		<style>
			.mui-content{
				padding: 0 5px;
			}
			p{
				line-height: 30px;
				color: #333;
			}
		</style>
	</head>

	<body class="dp-n" id="body">
		<header class="mui-bar mui-bar-nav titleBar-bgcolor" id="header">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left c-ff"></a>
			<h1 class="mui-title titleBar-color">详情页</h1>
		</header>
		<!--这里面是content页面-->
		<div class="mui-content">
			
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/immersed.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function() {
				plus.nativeUI.showWaiting("加载中...");
			
				document.getElementById('header').style.height = (immersed + 44) + 'px';
				document.querySelector('.mui-content').style.marginTop = (immersed) + 'px';
				
				// 隐藏了加载层（针对窗口的加载）
				plus.nativeUI.closeWaiting();
				// 把body的class名设为空
				mui('#body')[0].className = '';
				
				
				// 获取窗口页面传过来的参数aid
				//let self = plus.webview.currentWebview();
				//plus.nativeUI.alert('参数aid：'+self.aid)		//获得参数
				
			})
			//重写back
			
			
			//detailPage页，添加newId自定义事件监听
			window.addEventListener('newsId',function(event){
			    // 获得事件参数
			    var id = event.detail.aid;
				// plus.nativeUI.alert('参数aid：'+id)		//获得参数
				plus.nativeUI.showWaiting('加载中...')
				// 执行异步ajax,请求详情内容
				mui.ajax('https://unidemo.dcloud.net.cn/api/news/36kr/'+id,{
					data:{},
					dataType:'json',//服务器返回json格式数据
					type:'get',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					success:function(data){
						document.querySelector('.mui-content').innerHTML = data.content;
						plus.nativeUI.closeWaiting()
					},
					error:function(xhr,type,errorThrown){
						plus.nativeUI.closeWaiting()
					}
				});
			});
		</script>
	</body>

</html>